﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:m="clr-namespace:Signum.Windows"
	mc:Ignorable="d"
	x:Class="Signum.Windows.ErrorSummary"
	x:Name="me">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

        <Grid Visibility="{Binding Path=HasErrors, ElementName=me, Converter={x:Static m:Converters.BoolToVisibility}}">
            <TextBlock  x:Name="tb" Grid.Row="0" Margin="25,2,2,2"
					FontWeight="{Binding Path=HasErrors, Converter={x:Static m:Converters.BoolToBold}, ElementName=me}"
					Text="{Binding Path=ItemsSource, Converter={x:Static m:Converters.ErrorListToErrorCount}, ElementName=lb, Mode=Default}" 
                    TextTrimming="CharacterEllipsis"/>
            <Expander x:Name="expander" Grid.Row="0"
		IsEnabled="{Binding Path=HasErrors, ElementName=me, Converter={x:Static m:Converters.BoolToVisibility}}" 
		BorderThickness="{Binding Path=HasErrors, Converter={x:Static m:Converters.BoolToInt}, ElementName=me}"
		BorderBrush="Red">
              <ItemsControl x:Name="lb" 
                     Visibility="{Binding Path=IsExpanded, Converter={x:Static m:Converters.BoolToVisibility}, ElementName=expander, Mode=Default}" 
                     Background="Pink"></ItemsControl>
            </Expander>
        </Grid>
</UserControl>
